<template>
	<view class="list">
		<template v-for="item of collects">
			<my-item :key="item['id']" :data="item" />
		</template>
		<data-empty v-if="!collects.length" />
	</view>
</template>

<script>
	import item from '@/components/list-item'
	export default {
		components: {
			"my-item": item
		},
		data (){
			return {
				collects: []
			}
		},
		onLoad (){
			const { loginname } = this.$store.state.user_message
			this.getAuthorCollect(loginname)
		},
		methods: {
			async getAuthorCollect(author) {
				uni.showLoading()
				let result = await this.$request.get('/topic_collect/'+author)
				if(result.success){
					this.collects = result['data']
				}
				uni.hideLoading()
			}
		}
	}
</script>

<style>
</style>
